<?php

namespace Acme\FirmUsersBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;

class AdminUserForm extends AbstractType {

  public function buildForm(FormBuilder $builder, array $options) {
    $builder->add('username', 'text', array('required' => false));
    $builder->add('email', 'email', array('required' => false));
    $builder->add('password');
    $builder->add('userRoles', 'entity', array(
        'class' => 'AcmeFirmUsersBundle:Role',
        'expanded' => true,
        'multiple' => true
    ));
  }

  public function getDefaultOptions(array $options) {
    return array(
        'data_class' => 'Acme\FirmUsersBundle\Entity\User',
        'csrf_protection' => true,
        'csrf_field_name' => '_token',
        // a unique key to help generate the secret token
        'intention' => 'id',
    );
  }

  public function getName() {
    return 'create_new_user';
  }

}

?>
